package pyx.crazycards.game.managers;

import pyx.crazycards.game.managers.annotation.DataObject;
import pyx.crazycards.game.managers.annotation.Propertie;
import pyx.crazycards.game.managers.persistence.Persistable;
import pyx.crazycards.server.messages.CrazyCardsMessage;

/**
 * This class represents a connection token, owned by a player client. When a
 * client authenticates, the server generates a token to grant the player
 * access, every message sent by the player client needs to be signed with a
 * token.
 * 
 * @see User
 * @see CrazyCardsMessage
 * @author Abraao Isvi
 * 
 */
@DataObject(name = "token", base = "crazy.cards.game")
public class Token extends Persistable {

	@Propertie(name = "uuid")
	private String uuid;

	@Propertie(name = "lastAccess")
	private Long lastAccess;

	@Propertie(name = "valid")
	private Boolean valid;

	@Propertie(name = "user")
	private User user;

	@Propertie(name="ip")
	private String ip;
	
	@Propertie(name = "gameId")
	String gameId;

	public Long getLastAccess() {
		return lastAccess;
	}

	public void setLastAccess(Long lastAccess) {
		this.lastAccess = lastAccess;
	}

	public Boolean getValid() {
		return valid;
	}

	public void setValid(Boolean valid) {
		this.valid = valid;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getGameId() {
		return gameId;
	}

	public void setGameId(String gameId) {
		this.gameId = gameId;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}
	
}
